package pro.reznick.geoalarm;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.widget.Toast;

/**
 * @author alex
 * @since 8/17/11 10:15 PM
 */

public abstract class GeoAlarmBaseActivity extends Activity
{
    protected ControllerBinderTrait controllerTrait;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onStart();
        controllerTrait = new ControllerBinderTrait(this);
        controllerTrait.controllerEventsHandler = new ControllerBinderTrait.OnControllerBoundHandler()
        {
            @Override
            public void onControllerBound()
            {
                onControllerBoundEvent();
            }
        };
        controllerTrait.bindController();
    }

    @Override
    protected void onDestroy()
    {
        super.onDestroy();
        controllerTrait.unbindController();

    }


    protected abstract void onControllerBoundEvent();

    @Override
    protected void onStart()
    {
        super.onStart();
        controllerTrait.bindController();
    }

    @Override
    protected void onStop()
    {
        super.onStop();
        controllerTrait.unbindController();

    }


}
